package Test6.Operation;

import Test6.BOOK.BookList;
import Test6.BOOK.Main;

import java.util.Scanner;

public class FindOperation extends OutSystem implements IOperatopn{
    public void work(BookList bookList){
        System.out.println("请输入您要查找的书的名字:");
        Scanner sc = new Scanner(System.in);
        String finding= sc.nextLine();
        int flag = 0;
        for(int i=0;i< bookList.getUsedSize();i++ ){
            if(finding.compareTo(bookList.getBooks(i).getName())==0){
                System.out.println("成功找到书籍,信息如下:");
                System.out.println(bookList.books[i]);
                flag = 1;
            }
        }
        if (flag==0)
        {
            System.out.println("很抱歉!没有找到该书!");
        }
        new OutSystem().outSystem();
    }
}
